# -*- coding: utf-8 -*-
"""
Created on Sat Dec 22 22:10:26 2012

@author: Winand
"""
try: import simplejson as json_
except ImportError: import json as json_
from webapi.log import debug, error

def load(path):
    try:
        f = open(path, 'r')
        return json_.load(f)
    except IOError:
        error("Failed to load json file")
        return ""
        
def save(dat, path):
    try:
        f = open(path, 'w')
        json_.dump(dat, f, ensure_ascii=False)
        return True
    except IOError: error("Failed to save json file")
    
if __name__ == '__main__':
    COOKIE_FILE="C:\\cookie_rutracker.txt"
    print load(COOKIE_FILE)